
import requests
import json
import random
header = {
      "accept": "application/json, text/plain, */*",
      "accept-language": "zh-CN,zh;q=0.9",
      "authorization": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJhdXRob3JpdGllcyI6IiIsInVzZXJJZCI6InJvb3QiLCJ0ZW5hbmN5SWRzIjoiZGVmYXVsdCIsInN1YiI6IjI3Y2JlNzUzLWE5OGItNDVlOS05YzQ2LWRmYzk4NDhiYjYwOSIsImV4cCI6MTc1MTQ0MDEzMH0.cij71q1wim27OLC_5JXjFWX5oTpiuXAw0rwwhxusEEcb6BEaufhi20MSGwNumR9t8piB3eRcafp5ER4-Ull3Sg",
      "content-type": "application/json;charset=UTF-8"
    }
# http://192.168.13.17:8124/admin-api/sys/dicts-manage?pageSize=10&pageNum=1

url = 'http://192.168.13.17:8124/admin-api/sys/dicts-manage'
# //   开放关闭庄爱  0开放  1关闭
# project_risk_properties
keyWord = 'project_'+ 'bidWinningAndSigningStatus' +'_properties'
description = '这是'+'中标及签单情况'
arr = ['待中标','未开标','未签单','未中标','已签单','已中标待签单','项目取消']
# arrKey = ['leader','customer','pom internal','qa relative','operationer',]
# 干系人类型 领导leader 客户customer pom internal项目内部 qa relative相关人员 

arrOptions = [
    # 'finance-财务风险',
    
]


num = random.random() * 100 + 1

if (len(arrOptions) == 0):
    for item in range(len(arr)):
    
        params = {
            'value': str(item),# arrKey[item],#'0' + str(item),
            'label':arr[item],
            'type':keyWord,
            'description': description,
            'sort':num + item
        }
        res = requests.post(url,headers=header,data = json.dumps(params))
        print(res.text)
else:
    for item in range(len(arrOptions)):
        params = {
            'value': arrOptions[item].split('-')[0],# arrKey[item],#'0' + str(item),
            'label':arrOptions[item].split('-')[1],
            'type':keyWord,
            'description': description,
            'sort':num + item
        }
        res = requests.post(url,headers=header,data = json.dumps(params))
        print(res.text)










